{include file="public/header" /}
</head>
<body>
	<div id="main-container">
		{include file="public/menu" /}
		<div class="main">
			<div class="notice">{$position.url}</div>
			<div class="main_content">
				<div class="title">
					<span>{$position.name}</span>
				</div>
				{if $info.type eq 1}
				<a class="btn mr10" href="{:url('adddiyfield',['mid'=>$mid])}">新增字段</a><a class="btn mr10" href="{:url('adddiyline',['mid'=>$mid])}">新增分组线</a>
				{/if}
				<div class="table" v-el:table>
					<form id="export-form" method="post" action="{:url('index')}">
					<table class="layuitable">
						<thead>
							<tr>
								<th class="sort" width="60"><span>ID</span></th>
								<th width="100"><span>名称</span></th>
								<th width="100"><span>字段名</span></th>
								<th width="100"><span>类型</span></th>
								<th><span>提示</span></th>
								<th width="100"><span>排序</span></th>
								<th width="200"><span>操作</span></th>
							</tr>
						</thead>
						<tbody>
							{notempty name="infolist"}
		                    	{volist name="infolist" id="v"}
								<tr>
									<td>{$v.id}</td>
									<td>{$v.title}</td>
									<td>{$v.field}</td>
									<td>{$v.tname}</td>
									<td>{$v.remark}</td>
									<td>{if $info.type eq 1}<input class="sort" type="number" maxlength="4" data-id="{$v.id}" value="{$v.sort}"/>{else}{$v.id}{/if}</td>
									<td>
										{if $info.type eq 1}
										<a class="btn do-action" data-type="doEdit" data-href="{if $v.ftype eq '------'}{:url('editdiyline')}{else}{:url('editdiyfield')}{/if}" data-id="{$v.id}">编辑</a>
		                            	<a class="btn do-action" data-type="doDelOne" data-href="{if $v.ftype eq '------'}{:url('deldiyline',['ids'=>$v['id']])}{else}{:url('deldiyfield',['ids'=>$v['id']])}{/if}">删除</a>
		                            	{/if}
									</td>
								</tr>
								{/volist}
		                    {else /}
		                        <td colspan="7" class="text-center"> 暂未发现数据! </td>
		                    {/notempty}
						</tbody>
					</table>
				</div>
			</div>
		</div>
	</div>
<script>
layui.use(['common'], function(){
    var common=layui.common;

    $(document).on('blur','.sort', function () {
        var id = $(this).attr('data-id');
        var obs = $(this);
        $.ajax({
            url: '{:url("sortdiyfield")}',
            dataType: "json",
            data:{'id':id,'sort':obs.val()},
            type: "POST",
            success: function(data){
                //window.location = window.location;
            },
            error:function(ajaxobj)
            {
                if(ajaxobj.responseText!='')
                    alert(ajaxobj.responseText);
            }
        });
    });
});
</script>
</body>
</html>